/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author lomanda
 */
@Entity
@Table(name = "anotacoes")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Anotacoes.findAll", query = "SELECT a FROM Anotacoes a"),
    @NamedQuery(name = "Anotacoes.findByIdAnotacoes", query = "SELECT a FROM Anotacoes a WHERE a.idAnotacoes = :idAnotacoes"),
    @NamedQuery(name = "Anotacoes.findByInformacao", query = "SELECT a FROM Anotacoes a WHERE a.informacao = :informacao"),
    @NamedQuery(name = "Anotacoes.findByDate", query = "SELECT a FROM Anotacoes a WHERE a.date = :date")})
public class Anotacoes implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Column(name = "date")
    @Temporal(TemporalType.DATE)
    private Date date;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idAnotacoes")
    private Integer idAnotacoes;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 500)
    @Column(name = "informacao")
    private String informacao;
    @JoinColumn(name = "fkUsuario", referencedColumnName = "idUsuario")
    @ManyToOne(optional = false)
    private Usuario fkUsuario;
    @JoinColumn(name = "fkObra", referencedColumnName = "idObra")
    @ManyToOne(optional = false)
    private Projeto fkObra;

    public Anotacoes() {
    }

    public Anotacoes(Integer idAnotacoes) {
        this.idAnotacoes = idAnotacoes;
    }

    public Anotacoes(Integer idAnotacoes, String informacao, Date date) {
        this.idAnotacoes = idAnotacoes;
        this.informacao = informacao;
        this.date = date;
    }

    public Integer getIdAnotacoes() {
        return idAnotacoes;
    }

    public void setIdAnotacoes(Integer idAnotacoes) {
        this.idAnotacoes = idAnotacoes;
    }

    public String getInformacao() {
        return informacao;
    }

    public void setInformacao(String informacao) {
        this.informacao = informacao;
    }

    public Usuario getFkUsuario() {
        return fkUsuario;
    }

    public void setFkUsuario(Usuario fkUsuario) {
        this.fkUsuario = fkUsuario;
    }

    public Projeto getFkObra() {
        return fkObra;
    }

    public void setFkObra(Projeto fkObra) {
        this.fkObra = fkObra;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idAnotacoes != null ? idAnotacoes.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Anotacoes)) {
            return false;
        }
        Anotacoes other = (Anotacoes) object;
        if ((this.idAnotacoes == null && other.idAnotacoes != null) || (this.idAnotacoes != null && !this.idAnotacoes.equals(other.idAnotacoes))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Anotacoes[ idAnotacoes=" + idAnotacoes + " ]";
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }
    
}
